Merge pull request #406 from avoid3d/throttle-correction-comment
[betaflight.git] / docs / Board - Sparky.md
blob9501b5912e40e8ee243fe777a2d54316994598c3
1 # Board - Sparky
3 The Sparky is a very low cost and very powerful board.
5 * 3 hardware serial ports.
6 * Built-in serial port inverters which allows S.BUS receivers to be used without external inverters.
7 * USB (can be used at the same time as the serial ports).
8 * 10 PWM outputs.
9 * Dedicated PPM/SerialRX input pin.
10 * MPU9150 I2C Acc/Gyro/Mag
11 * Baro
13 # Status
15 Flyable!
17 Tested with revision 1 board. 
19 ## TODO
20 * Baro - detection works but sending bad readings, disabled for now.
21 * LED Strip
22 * ADC
23 * Sonar
24 * Display (via Flex port)
25 * SoftSerial - though having 3 hardware serial ports makes it a little redundant.
26 * Airplane PWM mappings.
28 # Flashing
30 ## Via Device Firmware Upload (DFU, USB) - Windows
32 These instructions are for flashing the Sparky board under Windows using DfuSE.
33 Credits go to Thomas Shue (Full video of the below steps can be found here: https://www.youtube.com/watch?v=I4yHiRVRY94)
35 Required Software:
36 DfuSE Version 3.0.2 (latest version 3.0.4 causes errors): http://code.google.com/p/multipilot32/downloads/detail?name=DfuSe.rar
37 STM VCP Driver 1.4.0: http://www.st.com/web/en/catalog/tools/PF257938
39 A binary file is required for DFU, not a .hex file.  If one is not included in the release then build one as follows.
41 ```
42 Unpack DfuSE and the STM VCP Drivers into a folder on your Hardrive
43 Download the latest Sparky release (cleanflight_SPARKY.hex) from:
44 https://github.com/cleanflight/cleanflight/releases and store it on your Hardrive
46 In your DfuSE folder go to BIN and start DfuFileMgr.exe
47 Select: "I want to GENERATE a DFUfile from S19,HEX or BIN files" press OK
48 Press: "S19 or Hex.." 
49 Go to the folder where you saved the cleanflight_SPARKY.hex file, select it  and press open
50 (you might need to change the filetype in the DfuSE explorer window to "hex Files (*.hex)" to be able to see the file)
51 Press: "Generate" and select the .dfu output file and location
52 If all worked well you should see " Success for 'Image for lternate Setting 00 (ST..)'!"
54 ```
56 Put the device into DFU mode by powering on the sparky with the bootloader pins temporarily bridged.  The only light that should come on is the blue PWR led.
58 Check the windows device manager to make sure the board is recognized correctly.
59 It should show up as "STM Device in DFU mode" under Universal Serial Bus Controllers
61 If it shows up as "STMicroelectronics Virtual COM" under Ports (COM & LPT) instead then the board is not in DFU mode. Disconnect the board, short the bootloader pins again while connecting the board.
63 If the board shows up as "STM 32 Bootloader" device in the device manager, the drivers need to be updated manually.
64 Select the device in the device manager, press "update drivers", select "manual update drivers" and choose the location where you extracted the STM VCP Drivers, select "let me choose which driver to install". You shoud now be able to select either the STM32 Bootloader driver or the STM in DFU mode driver. Select the later and install.
67 Then flash the binary as below.
69 ```
70 In your DfuSE folder go to BIN and start DfuSeDemo.exe
71 Select the Sparky Board (STM in DFU Mode) from the Available DFU and compatible HID Devices drop down list
72 Press "Choose.." at the bootom of the window and select the .dfu file created in the previous step
73 "File correctly loaded" should appear in the status bar
74 Press "Upgrade" and confirm with "Yes"
75 The status bar will show the upload progress and confirm that the upload is complete at the end
77 ```
79 Disconnect and reconnect the board from USB and continue to configure it via the Cleanflight configurator as per normal
82 ## Via Device Firmware Upload (DFU, USB) - Mac OS X
84 These instructions are for dfu-util, tested using dfu-util 0.7 for OSX from the OpenTX project.
86 http://www.open-tx.org/2013/07/15/dfu-util-07-for-mac-taranis-flashing-utility/
88 A binary file is required for DFU, not a .hex file.  If one is not included in the release then build one as follows.
90 ```
91 make TARGET=SPARKY clean
92 make TARGET=SPARKY binary
93 ```
95 Put the device into DFU mode by powering on the sparky with the bootloader pins temporarily bridged.  The only light that should come on is the blue PWR led.
97 Run 'dfu-util -l' to make sure the device is listed, as below.
99 ```
100 $ dfu-util -l
101 dfu-util 0.7
103 Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
104 Copyright 2010-2012 Tormod Volden and Stefan Schmidt
105 This program is Free Software and has ABSOLUTELY NO WARRANTY
106 Please report bugs to dfu-util@lists.gnumonks.org
108 Found DFU: [0483:df11] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash  /0x08000000/128*0002Kg"
109 Found DFU: [0483:df11] devnum=0, cfg=1, intf=0, alt=1, name="@Option Bytes  /0x1FFFF800/01*016 e"
112 Then flash the binary as below.
115 dfu-util -D obj/cleanflight_SPARKY.bin --alt 0 -R -s 0x08000000
118 The output should be similar to this:
121 dfu-util 0.7
123 Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
124 Copyright 2010-2012 Tormod Volden and Stefan Schmidt
125 This program is Free Software and has ABSOLUTELY NO WARRANTY
126 Please report bugs to dfu-util@lists.gnumonks.org
128 Opening DFU capable USB device... ID 0483:df11
129 Run-time device DFU version 011a
130 Found DFU: [0483:df11] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash  /0x08000000/128*0002Kg"
131 Claiming USB DFU Interface...
132 Setting Alternate Setting #0 ...
133 Determining device status: state = dfuERROR, status = 10
134 dfuERROR, clearing status
135 Determining device status: state = dfuIDLE, status = 0
136 dfuIDLE, continuing
137 DFU mode device DFU version 011a
138 Device returned transfer size 2048
139 No valid DFU suffix signature
140 Warning: File has no DFU suffix
141 DfuSe interface name: "Internal Flash  "
142 Downloading to address = 0x08000000, size = 76764
143 ......................................
144 File downloaded successfully
145 can't detach
146 Resetting USB to switch back to runtime mode
150 ## Via SWD
152 On the bottom of the board there is an SWD header socket onto switch a JST-SH connector can be soldered.
153 Once you have SWD connected you can use the st-link or j-link tools to flash a binary.
155 See Sparky schematic for CONN2 pinouts.
157 ## TauLabs bootloader
159 Flashing cleanflight will erase the TauLabs bootloader, this is not a problem and can easily be restored using the st flashloader tool.
161 # Serial Ports
163 | Value | Identifier   | RX        | TX         | Notes                                                                                       |
164 | ----- | ------------ | --------- | ---------- | ------------------------------------------------------------------------------------------- |
165 | 1     | USB VCP      | RX (USB)  | TX (USB)   |  |
166 | 2     | USART1       | RX / PB7  | TX / PB6   | Conn1 / Flexi Port. |
167 | 3     | USART2       | RX / PA3  | PWM6 / PA2 | On RX is on INPUT header.  Best port for Serial RX input |
168 | 4     | USART3       | RX / PB11 | TX / PB10  | RX/TX is on one end of the 6-pin header about the PWM outputs. |
170 USB VCP *can* be used at the same time as other serial ports (unlike Naze32).
172 All USART ports all support automatic hardware inversion which allows direct connection of serial rx receivers like the FrSky X4RSB - no external inverter needed.